<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\AdminAd
 *
 * @mixin IdeHelperAdminAd
 * @property int $id
 * @property int $positions_id 分类
 * @property int $user_group_id 团队
 * @property string $title 标题
 * @property string $author 作者
 * @property string $source 来源
 * @property string $show_at 发布时间
 * @property string $cover_path 封面图片
 * @property string|null $mini_wechat_link 微信小程序外联
 * @property string|null $pc_link 网站外联
 * @property string|null $content 内容
 * @property int $audit_status 0 待审核 1审核通过 2审核驳回
 * @property string|null $audit_response 审核结果
 * @property int $sort 排序
 * @property int $status 0 禁用 1启用
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property-read \App\Models\AdminUserGroup|null $group
 * @property-read \App\Models\AdminAdPosition|null $position
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd query()
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereAuditResponse($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereAuditStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereAuthor($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereCoverPath($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereMiniWechatLink($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd wherePcLink($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd wherePositionsId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereShowAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereSort($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereSource($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd whereUserGroupId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd withTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|AdminAd withoutTrashed()
 * @mixin \Eloquent
 */
class AdminAd extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'admin_ad';

    public function position()
    {
        return $this->belongsTo(AdminAdPosition::class, 'positions_id', 'id');
    }

    public function group()
    {
        return $this->belongsTo(AdminUserGroup::class, 'user_group_id', 'id');
    }
}
